package cn.com.czpb.client.module.notepad.adapter;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.com.czpb.client.R;
import cn.com.czpb.client.model.notepad.NotePdeBean;

/**
 * Created by Administrator on 2018/6/21.
 */

public class NotePadAdapter extends BaseMultiItemQuickAdapter<NotePdeBean, BaseViewHolder> {


    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    public NotePadAdapter(List<NotePdeBean> data) {
        super(data);
        addItemType(1, R.layout.item_notepad);
        addItemType(0, R.layout.item_notepad_1);
    }

    @Override
    protected void convert(BaseViewHolder helper, NotePdeBean item) {
        switch (helper.getItemViewType()) {
            case 1:
                helper.setText(R.id.tv_content, item.getContent());
                helper.setText(R.id.tv_time, item.getTime());
                helper.addOnClickListener(R.id.item);
                helper.addOnClickListener(R.id.iv_delete);
                break;
            case 0:
                helper.addOnClickListener(R.id.item);
                break;
        }
    }
}
